package sfmc.biz.daoImpl;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.stereotype.Repository;

import sfmc.biz.dao.SfmcCustomerDao;
import sfmc.biz.vo.Sfmc_TB_CUSTOMER;

@Repository("SfmcCustomerDao")
public class SfmcCustomerDaoImpl implements SfmcCustomerDao{
	protected Log log = LogFactory.getLog(this.getClass());
	
	@Autowired
	private SqlMapClientTemplate sqlMapClientTemplate;
	   
	public List<Sfmc_TB_CUSTOMER> getCustomerList(Sfmc_TB_CUSTOMER dto) {
		return sqlMapClientTemplate.queryForList("getCustomerList",dto);
	}

	public int insertCustomer(Sfmc_TB_CUSTOMER dto) {
		sqlMapClientTemplate.insert("insertCustomer", dto);
		return 0;
	}

	public int updateCustomer(Sfmc_TB_CUSTOMER dto) {
		return sqlMapClientTemplate.update("updateCustomer", dto);
	}

	public int deleteCustomer(Sfmc_TB_CUSTOMER dto) {
		return sqlMapClientTemplate.delete("deleteCustomer", dto);
	}

	@Override
	public int getCustomerCount(Sfmc_TB_CUSTOMER dto) {
		return Integer.parseInt(""+sqlMapClientTemplate.queryForObject("getCustomerCount",dto));
	}
}
